package com.example.mobile2030606148tdh0403;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

public class MainActivity extends AppCompatActivity {
   private Button forChange;
    private ImageView forDisplay;
    int[] image={R.drawable.line01_01,R.drawable.line01_02,R.drawable.line01_03,R.drawable.line01_04,R.drawable.line01_05,R.drawable.line01_06,};
    int y =0;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        forChange=(Button)findViewById(R.id.btn_main_next);
        forDisplay=(ImageView)findViewById(R.id.imageView);
        forDisplay.setImageResource(image[0]);
        forChange.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (y>=5){
                    y=-1;
                }
                forDisplay.setImageResource(image[++y]);
            }
        });
    }
}